<?php
/**
* Creation d'un tableau pour choix d'une couleur
* @param string $nom_calque Nom de l'objet calque a utiliser
*/
Function choix_couleurs ($nom_calque)
 {
  /*
  $c = var_courante ("c", 0, null) ;
  $t = var_courante ("t", 0, null) ;
  $cl = "#".var_courante ("cl", 0, "#ffffff") ;
  */
  // Table pour boucle
  $table1 [0] = 6 ;
  $table1 [1] = "00" ;
  $table1 [2] = "33" ;
  $table1 [3] = "66" ;
  $table1 [4] = "99" ;
  $table1 [5] = "CC" ;
  $table1 [6] = "FF" ;
  // Table de valeurs pour tableau supplementaire
  $table2 [0] = 8 ;
  $table2 [1] = "FFFFFF" ;
  $table2 [2] = "DDDDDD" ;
  $table2 [3] = "C0C0C0" ;
  $table2 [4] = "969696" ;
  $table2 [5] = "808080" ;
  $table2 [6] = "646464" ;
  $table2 [7] = "242424" ;
  $table2 [8] = "000000" ;
 
  $param_theme = parametres_theme (themeparsession ($_SESSION ["code"])) ;
  $rep_themes = "../../images/themes/" ;
  Include ($rep_themes.$param_theme ["nom_repertoire"]."/".$param_theme ["fichier_config"]) ;
 
  //Echo "<html><head>" ;
  //entete_html ("Garennes", "", 1) ;
  //Echo styles ("none", "none", "none", $theme [0][32], "none") ;
  Echo "<script type=\"text/javascript\">" ;
  Echo "function affiche(coul){" ;
  Echo "document.getElementsByName(\"selection\")[0].bgColor=coul;" ;
  //Echo "document.getElementsByName(\"".$nom_objet."\")[0].bgColor=coul;" ;
  //Echo "document.getElementsByName(\"".$nom_form."\")[0].value=coul;" ;
  Echo "}" ;
  Echo "</script>" ;
  //Echo "</head>" ;
  //Echo "<body background=\"".$rep_themes.$param_theme ["nom_repertoire"]."/".$theme [9][10]."\" text=\"".$l ["couleur_texte"]."\" onContextMenu=\"return false\">" ;
  Echo "<div id=\"".$nom_calque."\" style=\"display:none\">" ;
  $titre_fenetre = "Choix&nbsp;d'une&nbsp;couleur" ;
  $non_centrer = 0 ;
  Include ("../include/debut_theme.inc") ;
  Echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\" style=\"border-collapse:collapse\">" ;
  Echo "<tr><td colspan=\"3\">&nbsp;Cliquer&nbsp;sur&nbsp;une&nbsp;couleur,&nbsp;puis&nbsp;valider&nbsp;:</td></tr>" ;
  
  Echo "<tr><td colspan=\"3\" align=\"center\">&nbsp;<br>" ;
  Echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\"><tr><td>S&eacute;lection&nbsp;courante&nbsp;:&nbsp;</td>" ;
  Echo "<td width=\"50\"><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\" style=\"border:1px solid #000000;border-collapse:collapse\"><tr>" ;
  Echo "<td name=\"selection\" bgcolor=\"".$coul_defaut."\">&nbsp;</td></tr></table></td></tr></table></td></tr>" ;
  
  Echo "<tr><td colspan=\"3\" align=\"center\">&nbsp;</td></tr>" ;
  Echo "<tr><td>&nbsp;</td><td><table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"1\" style=\"border:1px solid #000000;border-collapse:collapse\">" ;
  For ($i = 1 ; $i <= $table1 [0] ; $i++)
   {
    Echo "<tr>" ;
    For ($j = 1 ; $j <= $table1 [0] ; $j++)
     {
      For ($k = 1 ; $k <= $table1 [0] ; $k++)
       {
        $chaine = $table1 [$i].$table1 [$j].$table1 [$k] ;
        Echo "<td bgcolor=\"#".$chaine."\" width=\"10\" height=\"10\">" ;
        Echo "<a href=\"javascript:affiche('#".$chaine."')\" onClick=\"javascript:affiche('#".$chaine."');return false\">" ;
        Echo "<img src=\"../images/t1010.gif\" alt=\"#".$chaine."\" border=\"0\" width=\"10\" height=\"10\"></a></td>" ;
       }
     }
    Echo "</tr>" ;
   }
  Echo "</table></td><td>&nbsp;</td></tr>" ;
  Echo "<tr><td colspan=\"3\">&nbsp;</td></tr>" ;
  Echo "<tr><td>&nbsp;</td><td align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" style=\"border:1px solid #000000;border-collapse:collapse\"><tr>" ;
  For ($i = 1 ; $i <= $table2 [0] ; $i++)
   {
    Echo "<td bgcolor=\"#".$table2 [$i]."\" width=\"10\" height=\"10\">" ;
    Echo "<a href=\"#\" onClick=\"javascript:affiche('#".$table2 [$i]."');return false\">" ;
    Echo "<img src=\"../images/t1010.gif\" alt=\"#".$table2 [$i]."\" border=\"0\" width=\"10\" height=\"10\"></a></td>" ;
   }
  Echo "</tr></table></td></tr>" ;
  Echo "<tr><td colspan=\"3\">&nbsp;</td></tr>" ;
  Echo "<tr><td colspan=\"3\" align=\"right\"><img src=\"".$rep_themes.$param_theme ["nom_repertoire"]."/".$theme [9][0]."\" border=\"0\" onClick=\"javascript:window.close()\"></td></tr>" ;
  Echo "</table>" ;
  Include ("../include/fin_theme.inc") ;
  //Echo "</body></html>" ;
  Echo "</div>" ;
 }
?>